package Java.BlackHorse.Stream;

import java.util.HashMap;
import java.util.Map;
import java.util.function.Consumer;

public class StreamDemo2 {
    public static void main(String[] args) {
        //双列集合
        HashMap<String,Integer> hm = new HashMap<>();
        hm.put("aaa",111);
        hm.put("bbb",222);
        hm.put("ccc",333);
        hm.put("ddd",444);
        hm.put("eee",555);

        //第一种Stream流 遍历值
        hm.keySet().stream().forEach(s-> {
            System.out.print(s);
            System.out.print("=");
            System.out.println(hm.get(s));
        });

        System.out.println("====================");

        //第二种Stream流 遍历键值对
        hm.entrySet().stream().forEach(stringIntegerEntry -> System.out.println(stringIntegerEntry));

    }
}
